<?php
//Connection statement
require_once('../../Connections/cn.php');

// Load the common classes
require_once('../../includes/common/KT_common.php');

// Load the required classes
require_once('../../includes/tfi/TFI.php');
require_once('../../includes/tso/TSO.php');
require_once('../../includes/nav/NAV.php');

// Filter
$tfi_listorigen1 = new TFI_TableFilter($cn, "tfi_listorigen1");
$tfi_listorigen1->addColumn("origen.NOMBRE_ORIGEN", "STRING_TYPE", "NOMBRE_ORIGEN", "%");
$tfi_listorigen1->Execute();

// Sorter
$tso_listorigen1 = new TSO_TableSorter("rsorigen1", "tso_listorigen1");
$tso_listorigen1->addColumn("origen.NOMBRE_ORIGEN");
$tso_listorigen1->setDefault("origen.NOMBRE_ORIGEN");
$tso_listorigen1->Execute();

// Navigation
$nav_listorigen1 = new NAV_Regular("nav_listorigen1", "rsorigen1", "../../", $_SERVER['PHP_SELF'], 10);

// Begin List Recordset
$maxRows_rsorigen1 = $_SESSION['max_rows_nav_listorigen1'];
$pageNum_rsorigen1 = 0;
if (isset($_GET['pageNum_rsorigen1'])) {
  $pageNum_rsorigen1 = $_GET['pageNum_rsorigen1'];
}
$startRow_rsorigen1 = $pageNum_rsorigen1 * $maxRows_rsorigen1;
$NXTFilter__rsorigen1 = '1=1';
if (isset($_SESSION['filter_tfi_listorigen1'])) {
  $NXTFilter__rsorigen1 = $_SESSION['filter_tfi_listorigen1'];
}
$NXTSort__rsorigen1 = 'origen.NOMBRE_ORIGEN';
if (isset($_SESSION['sorter_tso_listorigen1'])) {
  $NXTSort__rsorigen1 = $_SESSION['sorter_tso_listorigen1'];
}
$query_rsorigen1 = sprintf("SELECT origen.NOMBRE_ORIGEN, origen.ID_ORIGEN FROM origen WHERE %s ORDER BY %s", $NXTFilter__rsorigen1, $NXTSort__rsorigen1);
$rsorigen1 = $cn->SelectLimit($query_rsorigen1, $maxRows_rsorigen1, $startRow_rsorigen1) or die($cn->ErrorMsg());
if (isset($_GET['totalRows_rsorigen1'])) {
  $totalRows_rsorigen1 = $_GET['totalRows_rsorigen1'];
} else {
  $all_rsorigen1 = $cn->SelectLimit($query_rsorigen1) or die($cn->ErrorMsg());
  $totalRows_rsorigen1 = $all_rsorigen1->RecordCount();
}
$totalPages_rsorigen1 = (int)(($totalRows_rsorigen1-1)/$maxRows_rsorigen1);
// End List Recordset

$nav_listorigen1->checkBoundries();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php //PHP ADODB document - made with PHAkt 3.6.0?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../../includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="../../includes/common/js/base.js" type="text/javascript"></script>
<script src="../../includes/common/js/utility.js" type="text/javascript"></script>
<script src="../../includes/skins/style.js" type="text/javascript"></script>
<script src="../../includes/nxt/scripts/list.js" type="text/javascript"></script>
<script src="../../includes/nxt/scripts/list.js.php" type="text/javascript"></script>
<script type="text/javascript">
$NXT_LIST_SETTINGS = {
  duplicate_buttons: false,
  duplicate_navigation: false,
  row_effects: true,
  show_as_buttons: false,
  record_counter: true
}
</script>
<style type="text/css">
  /* NeXTensio3 List row settings */
  .KT_col_NOMBRE_ORIGEN {width:350px; overflow:hidden;}
</style>
</head>

<body>

<div class="KT_tng" id="listorigen1">
  <h1> Origen
    <?php
  $nav_listorigen1->Prepare();
  require("../../includes/nav/NAV_Text_Statistics.inc.php");
?>
  </h1>
  <div class="KT_tnglist">
    <form action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>" method="post" id="form1">
      <div class="KT_options"> <a href="<?php echo $nav_listorigen1->getShowAllLink(); ?>"><?php echo NXT_getResource("Show"); ?>
            <?php 
  // Show IF Conditional region1 
  if (@$_GET['show_all_nav_listorigen1'] == 1) {
?>
              <?php echo $_SESSION['default_max_rows_nav_listorigen1']; ?>
              <?php 
  // else Conditional region1
  } else { ?>
              <?php echo NXT_getResource("all"); ?>
              <?php } 
  // endif Conditional region1
?>
            <?php echo NXT_getResource("records"); ?></a> &nbsp;
        &nbsp;
                            <?php 
  // Show IF Conditional region2 
  if (@$_SESSION['has_filter_tfi_listorigen1'] == 1) {
?>
                              <a href="<?php echo $tfi_listorigen1->getResetFilterLink(); ?>"><?php echo NXT_getResource("Reset filter"); ?></a>
                              <?php 
  // else Conditional region2
  } else { ?>
                              <a href="<?php echo $tfi_listorigen1->getShowFilterLink(); ?>"><?php echo NXT_getResource("Show filter"); ?></a>
                              <?php } 
  // endif Conditional region2
?>
      </div>
      <table cellpadding="2" cellspacing="0" class="KT_tngtable">
        <thead>
          <tr class="KT_row_order">
            <th> <input type="checkbox" name="KT_selAll" id="KT_selAll"/>
            </th>
            <th id="NOMBRE_ORIGEN" class="KT_sorter KT_col_NOMBRE_ORIGEN <?php echo $tso_listorigen1->getSortIcon('origen.NOMBRE_ORIGEN'); ?>"> <a href="<?php echo $tso_listorigen1->getSortLink('origen.NOMBRE_ORIGEN'); ?>">Nombre_origen</a> </th>
            <th>&nbsp;</th>
          </tr>
          <?php 
  // Show IF Conditional region3 
  if (@$_SESSION['has_filter_tfi_listorigen1'] == 1) {
?>
            <tr class="KT_row_filter">
              <td>&nbsp;</td>
              <td><input type="text" name="tfi_listorigen1_NOMBRE_ORIGEN" id="tfi_listorigen1_NOMBRE_ORIGEN" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listorigen1_NOMBRE_ORIGEN']); ?>" size="50" maxlength="50" /></td>
              <td><input type="submit" name="tfi_listorigen1" value="<?php echo NXT_getResource("Filter"); ?>" /></td>
            </tr>
            <?php } 
  // endif Conditional region3
?>
        </thead>
        <tbody>
          <?php if ($totalRows_rsorigen1 == 0) { // Show if recordset empty ?>
            <tr>
              <td colspan="3"><?php echo NXT_getResource("The table is empty or the filter you've selected is too restrictive."); ?></td>
            </tr>
            <?php } // Show if recordset empty ?>
          <?php if ($totalRows_rsorigen1 > 0) { // Show if recordset not empty ?>
            <?php
  while (!$rsorigen1->EOF) { 
?>
              <tr class="<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>">
                <td><input type="checkbox" name="kt_pk_origen" class="id_checkbox" value="<?php echo $rsorigen1->Fields('ID_ORIGEN'); ?>" />
                    <input type="hidden" name="ID_ORIGEN" class="id_field" value="<?php echo $rsorigen1->Fields('ID_ORIGEN'); ?>" />
                </td>
                <td><div class="KT_col_NOMBRE_ORIGEN"><?php echo KT_FormatForList($rsorigen1->Fields('NOMBRE_ORIGEN'), 50); ?></div></td>
                <td><a class="KT_edit_link" href="?mod=origen&acc=agregar&amp;ID_ORIGEN=<?php echo $rsorigen1->Fields('ID_ORIGEN'); ?>&amp;KT_back=1"><?php echo NXT_getResource("edit_one"); ?></a> <a class="KT_delete_link" href="#delete"><?php echo NXT_getResource("delete_one"); ?></a> </td>
              </tr>
              <?php
    $rsorigen1->MoveNext(); 
  }
?>
            <?php } // Show if recordset not empty ?>
        </tbody>
      </table>
      <div class="KT_bottomnav">
        <div>
          <?php
            $nav_listorigen1->Prepare();
            require("../../includes/nav/NAV_Text_Navigation.inc.php");
          ?>
        </div>
      </div>
      <div class="KT_bottombuttons">
        <div class="KT_operations"> <a class="KT_edit_op_link" href="#" onclick="nxt_list_edit_link_form(this); return false;"><?php echo NXT_getResource("edit_all"); ?></a> <a class="KT_delete_op_link" href="#" onclick="nxt_list_delete_link_form(this); return false;"><?php echo NXT_getResource("delete_all"); ?></a> </div>
        <span>&nbsp;</span>
        <select name="no_new" id="no_new">
          <option value="1">1</option>
          <option value="3">3</option>
          <option value="6">6</option>
        </select>
        <a class="KT_additem_op_link" href="?mod=origen&acc=agregar&amp;KT_back=1" onclick="return nxt_list_additem(this)"><?php echo NXT_getResource("add new"); ?></a> </div>
    </form>
  </div>
  <br class="clearfixplain" />
</div>
<p>&nbsp;</p>
</body>
</html>
<?php
$rsorigen1->Close();
?>
